home *** CD-ROM | disk | FTP | other *** search
- From: vandevod@cs.rpi.edu (David Vandevoorde)
- Message-ID: <xsobuo2pbbn.fsf@avs.cs.rpi.edu>
- X-Original-Date: 17 Jan 1996 19:59:24 -0500
- Path: in2.uu.net!bounce-back
- Date: 18 Jan 96 02:41:35 GMT
- Approved: fjh@cs.mu.oz.au
- Newsgroups: comp.std.c++
- Subject: Re: type_info
- Organization: RPI Computer Science
- References: <30FD350D.A71@xagony.ilo.dec.com>
- In-Reply-To: "B. Dalton"'s message of 17 Jan 1996 12:22:51 PST
- X-Newsreader: Gnus v5.1
- X-Auth: PGPMoose V1.1 PGP comp.std.c++
- iQBFAgUBMP2za+EDnX0m9pzZAQF2+wF+Oddt6d4EVOMvxmrNcH7skgGyqGEJPdOR
- A69nfwSmOFdU+pQqVr0PhFw13RIfoS9G
- =YujM
-
- >>>>> "BD" == "B Dalton" <bdalton@xagony.ilo.dec.com> writes:
- BD> class beatha{public:virtual ~beatha(){};}
- BD> class duine:public beatha{};
- BD> class gael: public duine {};
-
- BD> beatha *pd=new gael;
- BD> if(typeid(pd)==typeid(duine)
- BD> { cout<<"duine";
- BD> }
- BD> ...
- BD> does "duine" get printed here or not?
-
- No, it doesn't since typeid(pd) = typeid(beatha*).
- You probably meant `if(typeid(*pd)==typeid(duine)) ...',
- but even then the answer is `no': typeid(*pd)==typeid(gael).
-
- Daveed
- ---
- [ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
- Contact address: std-c++-request@ncar.ucar.edu. The moderation policy
- is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
-